As the final step to creating a UFL function (see Function Definition), you must add code for the operation of the function you have designed. Your function must be programmed for the specific needs of your UFL. This section will examine the basics of how to obtain the parameters from the parameter block and use the values of those parameters in the implementation of the UFL function.
You begin by coding your function as follows:
ExternC UFError FAR _export PASCAL FunctionName
(UFParamBlock *ParamBlock)
{
// Your function's code
}
First, notice that the function is exported because a UFL is simply a DLL being accessed by Crystal Reports. Second, the function returns an error code of the enumerated type UFError. In the error trapping sections of your function, you can return a UFError value, such as UFNotEnoughParameters, or you can return UFUserError and define your own errors in the error table. Finally, the function accepts a parameter block of type UFParamBlock from Crystal Reports rather than individual parameters. You will need to retrieve the individual parameters from that parameter block to work with the data values passed by the Formula Editor.
Note: ExternC is defined in UFDLL.H and is equivalent to: extern "C".
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |